<template>
  <van-overlay :show.sync="visible" @click="hide">
    <div class="video-box" v-if="visible">
      <video :src="params.src" autoplay controls />
    </div>
  </van-overlay>
</template>

<script>
export default {
  name: 'VideoDialog',
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    params: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    hide() {
      this.$emit('update:visible', false);
    },
  },
};
</script>

<style lang="scss" scoped>
.video-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  video {
    width: 100%;
  }
}
</style>
